﻿using System.Collections.Generic;
using System.Linq;
using Mysoft.Platform.OnlineLibrary.Entity;

namespace Mysoft.Platform.OnlineLibrary.Models
{
	public class BatchLogModel : BatchLogEntity
	{
		private List<string> _bookNameList;

		public List<string> BookNameList
		{
			get
			{
				if( !string.IsNullOrEmpty(BookList) ) {
					_bookNameList = BookList.Split(',').ToList();
					return _bookNameList;
				}
				else {
					return new List<string>();
				}
			}
		}

		private BookOperation _oprType = BookOperation.None;

		public BookOperation OprType
		{
			get
			{
				if( _oprType == BookOperation.None && OperationType > 0 ) {
					_oprType = (BookOperation)OperationType;
				}
				return _oprType;
			}
		}

		public string OperationName
		{
			get
			{
				switch( OprType ) {
					case BookOperation.Borrow:
						return "借阅";
					case BookOperation.Return:
						return "归还";
					case BookOperation.Renew:
						return "续借";
					case BookOperation.Lost:
						return "挂失";
					default:
						return "";
				}
			}
		}
	}
}